home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 19
/
Mac Magazin and MacEasy Magazine CD - Issue 19.iso
/
Online
/
LineShare 3.3.1
/
LineShare Scripts
/
Telebit 2500 ARA&Data
< prev
next >
Wrap
Text File
|
1994-02-10
|
5KB
|
244 lines
!$ Version 2.1
!$ Requires: Telebit 2500 modem
!$ Supports: ARA and a generic comm. software (QuickMail, BBS, etc) in the server mode.
!$ For ARA use: ARA/LineShare script.
!$ For Data use: generic settings (if Apple Modem Tool is used,
!$ remove all register settings using the Custom… option).
^2 Speaker On: = Enum("Never" = "0" , "When Connecting" = "1", "Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="50","Medium"="150","High"="250") "150"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Max Port Speed: = Enum("9600","19200","38400") "19200"
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
Sbreak
write "ATH0&F\r"
matchread 20
ChrDelay 1
Write "+++"
ChrDelay 0
DtrClear
pause 10
DtrSet
!
DecTries
! SerReset 19200,0,8,1
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
@Label 10
SerReset Val("^5"),0,8,1
Jsr 80
!
! Set the common options
Jsr 70
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4\r"
Jsr 100
Note "Waiting for ARA/Data calls…"
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
@Label 12
MatchClr
matchstr 1 13 "RING\r\n"
matchstr 2 21 "\r\nCONNECT ^$/"
matchstr 3 15 "\r\nCONNECT ^$\r\n"
matchstr 10 10 "\r\nNO "
matchstr 11 10 "\r\nBUSY"
Matchread 1200
Jump 10
@Label 13
Note "Ring…"
Jump 12
!
! Data connection has been established (we read "CONNECT XXX\r\n")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 15
SetVar A "^$"
IfStr A 17 "FAST"
@Label 16
Note "Non-V.42 Call at ^A bps. Waiting for an ARA frame."
MatchClr
MatchStr 1 20 "\r"
MatchStr 2 30 "\08\01\03\14\04\03\00\08\250\16\03"
MatchRead 40
@Label 20
Note "Non-ARA call"
Jump 24
@Label 17
SetVar A "19200"
Jump 16
!
! V.42 call detected
!
@Label 21
SetVar A "^$"
Note "V.42 Call at ^A bps"
MatchClr
MatchStr 1 24 "\r\n"
MatchRead 5
@Label 24
QueueInput "\r\nRING\r\n\r\nCONNECT ^A\r\n"
@Label 25
Attach "Data" (DTR,Escape,TimeLimit=0)
!
! The ARA (MNP 4) frame detected
!
@Label 30
Note "ARA call at ^A bps."
Flush
QueueInput "^A\r\n"
@Label 31
QueueInput "\r\nCARRIER "
@Label 35
ifOriginate 36
QueueInput "\r\nRING\r\n"
@Label 36
Attach "ARA" (DTR,Escape,TimeLimit=0)
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset Val("^5"),0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Prepare to receive all error result codes
!
Jsr 90
MatchStr 1 31 "\r\nCONNECT "
MatchRead 900
Write "\r"
Exit -6019
! ------------------------------------------
! Originating a call through the "Data" subport
! ------------------------------------------
@ORIGINATE "Data"
SerReset Val("^5"),0,8,1
Jsr 80
Jsr 70
!
! Now emit all commands that the application has sent to that port
!
Jsr 60
SerReset *
Jsr 80
!
! Prepare to receive all error result codes
!
Flush
Jsr 90
MatchStr 1 48 "^$\r\nCONNECT"
MatchRead 900
Write "\r"
Exit -6019
@Label 48
QueueInput "^$\r\nCONNECT"
Jump 25
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
!
@Label 70
Write "AT~&FM^2S61=^3V1E0\r"
Jsr 100
Write "AT S58=2 S66=1 S68=2 S92=1 S95=0 S97=1 S106=1\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 102 "\r\nOK\r\n"
MatchStr 2 101 "\r\nERROR\r\n"
MatchRead 20
@Label 101
Exit -6019
@Label 102
return